<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>App Runner System Info</title>
    <link rel="stylesheet" href="site.css">
</head>
<body>

<header th:replace="base.html :: header"></header>

<main>

    <h2>System Info</h2>

    <p>All this information is also available via the <a href="/app-runner-home/docs/api.html#!/System/systemInfo">System API</a>.</p>

    <h3>The router</h3>

    <p><a href="https://github.com/danielflower/app-runner-router">App Runner Router</a> is being used.</p>

    <table class="systemTable">
        <tbody>
        <tr>
            <th>Host</th>
            <td th:text="${instanceHost}">name</td>
        </tr>
        <tr>
            <th>User</th>
            <td th:text="${user}">name</td>
        </tr>
        <tr>
            <th>Router version</th>
            <td th:text="*{appRunnerVersion}?: 'unknown'">name</td>
        </tr>
        <tr>
            <th>OS</th>
            <td th:text="${os.osName}">name</td>
        </tr>
        <tr>
            <th>PID</th>
            <td th:text="${#numbers.formatInteger(os.appRunnerPid, 0)}">name</td>
        </tr>
        <tr>
            <th>Up-time</th>
            <td><span th:text="${#numbers.formatInteger(os.uptimeInSeconds / 3600, 0)}">name</span> hours</td>
        </tr>
        </tbody>
    </table>

    <h3>The instances</h3>

    <div th:each="runner : ${runners}">
        <h4 th:text="${runner.id}">Runner ID</h4>
        <table class="systemTable" th:classappend="${runner.error} ? error : ok">
            <tbody>
            <tr>
                <th>ID</th>
                <td th:text="${runner.id}">name</td>
            </tr>
            <tr th:if="${runner.error}">
                <th>Error</th>
                <td><strong th:text="${runner.error}">Error</strong></td>
            </tr>
            <tr>
                <th>Current number of apps</th>
                <td th:text="${#numbers.formatInteger(runner.appCount, 0)}">name</td>
            </tr>
            <tr>
                <th>Max number of apps</th>
                <td th:text="${#numbers.formatInteger(runner.maxApps, 0)}">name</td>
            </tr>
            <tr>
                <th>Apps API URL</th>
                <td><a href="/system" th:href="${runner.appsUrl}" th:text="${runner.appsUrl}">name</a></td>
            </tr>
            <tr>
                <th>System API URL</th>
                <td><a href="/system" th:href="${runner.systemUrl}" th:text="${runner.systemUrl}">name</a></td>
            </tr>
            <tr>
                <th>Host</th>
                <td th:text="${runner.system.host}">name</td>
            </tr>
            <tr>
                <th>User</th>
                <td th:text="${runner.system.user}">name</td>
            </tr>
            <tr>
                <th>App Runner version</th>
                <td th:text="*{runner.system.appRunnerVersion}?: 'unknown'">name</td>
            </tr>
            <tr th:if="${runner.system.os}">
                <th>OS</th>
                <td th:text="${runner.system.os.osName}">name</td>
            </tr>
            <tr th:if="${runner.system.os}">
                <th>PID</th>
                <td th:text="${#numbers.formatInteger(runner.system.os.appRunnerPid, 0)}">name</td>
            </tr>
            <tr th:if="${runner.system.os}">
                <th>Up-time</th>
                <td><span th:text="${#numbers.formatInteger(runner.system.os.uptimeInSeconds / 3600, 0)}">name</span> hours</td>
            </tr>
            <tr th:if="${runner.system.backupInfo}" th:with="backup=${runner.system.backupInfo}">
                <th>Last backup</th>
                <td><time th:if="${backup.lastSuccessfulBackup}" th:text="${backup.lastSuccessfulBackup}">time</time> <span class="error" th:if="${backup.lastBackupError}" th:text="${backup.lastBackupError}">error</span></td>
            </tr>
            <tr th:if="${runner.system.backupInfo}" th:with="backup=${runner.system.backupInfo}">
                <th>Backup URL</th>
                <td><code th:text="${backup.backupUrl}">ssh://blah</code></td>
            </tr>
            <tr th:each="publicKey : ${publicKeys}">
                <th>Public key</th>
                <td><pre th:text="*{publicKey}?: '(public key not detected)'" class="overflower">
                    KEY
                </pre></td>
            </tr>
            <tr th:each="sample : ${runner.system.samples}">
                <th th:text="${sample.name}">Runner</th>
                <td><pre class="overflower" th:text="${sample.version}">1.0</pre></td>
            </tr>
            </tbody>
        </table>

    </div>

</main>

<footer th:replace="base.html :: footer"></footer>

</body>
</html>
